import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86186
 * Date: 2023-09-06
 * Time: 22:23
 */
public class ThreadDemo2 {
    private volatile static int flg = 0;
    public static void main(String[] args) {
        Thread t1 = new Thread(() -> {
           while(flg == 0) {
               ;
           }
            System.out.println("线程t1 结束");
        });
        t1.start();

        Thread t2 = new Thread(() -> {
            Scanner scanner = new Scanner(System.in);
            System.out.println("flg = ");
            flg = scanner.nextInt();
        });
        t2.start();
    }
}
